package chapter007.point01;

/**
 * 代码来源: https://www.runoob.com/java/java-abstraction.html
 *
 * @author Jack魏
 */
public class Salary extends Employee {
    private double salary;

    public Salary(String name, String address, int number, double
            salary) {
        super(name, address, number);
        setSalary(salary);
    }

    public void mailCheck() {
        System.out.println("Salary 类 运行方法 mailCheck ");
        System.out.println("应发工资给 " + getName()
                + " " + salary);
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double newSalary) {
        if (newSalary >= 0.0) {
            salary = newSalary;
        }
    }

    public double computePay() {
        System.out.println("计算应付工资人: " + getName());
        return salary / 52;
    }
}
